<?php
defined('BY_JYA') or exit('error');
$_RQ['op']=$_RQ['op']?$_RQ['op']:'basic';
$return=array();
/*******basic*******/
if($_RQ['op']=='basic'){
	if($_RQ['postdata']){
		$postdata=get_postdata();
		$this->plugin_setting('basic',$postdata);
		exi('设置成功');
	}
	$return['item']=$this->plugin_setting('basic');
	$return['item']['apiurl']=SITEROOT.'addons/jy_wechatnews/api.php?i='.$_SESSION['uniacid'].'&username=xxx&pass=xxx&mid=xxx&mid=XX&type=1&num=10&timestamp=xxx&sign=xxx';
	$return['item']['secret']=$return['item']['secret']?:random(30);
	if(!$return['item']['secret']){
		$return['item']['secret']=random(30);
		$this->plugin_setting('basic',$return['item']);
	}
	$htmls=array(
		'type'=>'edit',
		'desc'=>'参数设置',
		'edit_tab'=>true,
		'edits'=>array(
			array(
				'title'=>'基本信息',
				'list'=>array(
					array('type'=>'tip','title'=>'username:SaaS账户；pass:SaaS密码；mid：要充值的会员ID；type:虚拟币类型（1、积分；2、余额；3、金币；4、元宝；5、备用金；6、R币）；num:金币数量；sign签名由函数get_sign($_GET,$secret);生成；'),
					array('type'=>'copy','title'=>'免签充值地址示例','name'=>'apiurl'),
					array('type'=>'copy','title'=>'免签密钥','name'=>'secret','help'=>'用于加密签名使用！'),
				)
			),
		),
	);
	$return['htmls']=$htmls;
	exi($return);
}
/*******basic*******/
/*******op*******/
